<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>vuepress-plugin-git-log | VuePress Community</title>
    <meta name="description" content="Community supported ecosystem for VuePress">
    <link rel="icon" href="/logo/600x600.png">
  <meta name="theme-color" content="#3eaf7c">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="msapplication-TileColor" content="#000000">
    <link rel="preload" href="/assets/css/0.styles.bde909c2.css" as="style"><link rel="preload" href="/assets/js/app.83cb924b.js" as="script"><link rel="preload" href="/assets/js/2.96e68d5e.js" as="script"><link rel="preload" href="/assets/js/14.78046e0f.js" as="script"><link rel="preload" href="/assets/js/5.1cd3ace7.js" as="script"><link rel="prefetch" href="/assets/js/10.8fab5e9f.js"><link rel="prefetch" href="/assets/js/11.9e66637f.js"><link rel="prefetch" href="/assets/js/12.23a476a6.js"><link rel="prefetch" href="/assets/js/13.cbd5d914.js"><link rel="prefetch" href="/assets/js/15.15f2d0bd.js"><link rel="prefetch" href="/assets/js/16.c749a5c9.js"><link rel="prefetch" href="/assets/js/17.f54b2102.js"><link rel="prefetch" href="/assets/js/18.0da93583.js"><link rel="prefetch" href="/assets/js/19.7ec782b6.js"><link rel="prefetch" href="/assets/js/20.2ac16953.js"><link rel="prefetch" href="/assets/js/21.059dc84f.js"><link rel="prefetch" href="/assets/js/22.b80a1088.js"><link rel="prefetch" href="/assets/js/23.14ac2e9b.js"><link rel="prefetch" href="/assets/js/24.645912bb.js"><link rel="prefetch" href="/assets/js/25.d99ab9d1.js"><link rel="prefetch" href="/assets/js/26.439ac2ad.js"><link rel="prefetch" href="/assets/js/27.7a5265ba.js"><link rel="prefetch" href="/assets/js/28.68a7bdf2.js"><link rel="prefetch" href="/assets/js/29.83d3986f.js"><link rel="prefetch" href="/assets/js/3.e29c89cb.js"><link rel="prefetch" href="/assets/js/30.44036763.js"><link rel="prefetch" href="/assets/js/31.4e32f3c0.js"><link rel="prefetch" href="/assets/js/32.5c64f4c8.js"><link rel="prefetch" href="/assets/js/33.bc6170ff.js"><link rel="prefetch" href="/assets/js/34.2a1877c0.js"><link rel="prefetch" href="/assets/js/35.6a0693b1.js"><link rel="prefetch" href="/assets/js/36.036cfdd9.js"><link rel="prefetch" href="/assets/js/37.5c4deb98.js"><link rel="prefetch" href="/assets/js/4.a98f17db.js"><link rel="prefetch" href="/assets/js/6.b1866fbb.js"><link rel="prefetch" href="/assets/js/7.757f3a25.js"><link rel="prefetch" href="/assets/js/8.e5910e9d.js"><link rel="prefetch" href="/assets/js/9.68190a5d.js">
    <link rel="stylesheet" href="/assets/css/0.styles.bde909c2.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/en/" class="home-link router-link-active"><!----> <span class="site-name">VuePress Community</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title">Languages</span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/plugins/git-log/" class="nav-link router-link-exact-active router-link-active">English</a></li><li class="dropdown-item"><!----> <a href="/zh/plugins/git-log/" class="nav-link">简体中文</a></li></ul></div></div> <a href="https://github.com/vuepress/vuepress.github.io" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title">Languages</span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/plugins/git-log/" class="nav-link router-link-exact-active router-link-active">English</a></li><li class="dropdown-item"><!----> <a href="/zh/plugins/git-log/" class="nav-link">简体中文</a></li></ul></div></div> <a href="https://github.com/vuepress/vuepress.github.io" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Plugins</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/en/plugins/container/" class="sidebar-link">vuepress-plugin-container</a></li><li><a href="/en/plugins/copyright/" class="sidebar-link">vuepress-plugin-copyright</a></li><li><a href="/en/plugins/clean-urls/" class="sidebar-link">vuepress-plugin-clean-urls</a></li><li><a href="/en/plugins/dehydrate/" class="sidebar-link">vuepress-plugin-dehydrate</a></li><li><a href="/en/plugins/git-log/" class="active sidebar-link">vuepress-plugin-git-log</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#usage" class="sidebar-link">Usage</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#global-installation" class="sidebar-link">Global Installation</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#local-installation" class="sidebar-link">Local Installation</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#add-to-config-js" class="sidebar-link">Add to config.js</a></li></ul></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#api" class="sidebar-link">API</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#git-author" class="sidebar-link">git.author</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#git-created" class="sidebar-link">git.created</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#git-updated" class="sidebar-link">git.updated</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#git-commits" class="sidebar-link">git.commits</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#git-contributors" class="sidebar-link">git.contributors</a></li></ul></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#configurations" class="sidebar-link">Configurations</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#formattime" class="sidebar-link">formatTime</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#additionalprops" class="sidebar-link">additionalProps</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#additionalargs" class="sidebar-link">additionalArgs</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#extendgitlog" class="sidebar-link">extendGitLog</a></li><li class="sidebar-sub-header"><a href="/en/plugins/git-log/#onlyfirstandlastcommit" class="sidebar-link">onlyFirstAndLastCommit</a></li></ul></li></ul></li><li><a href="/en/plugins/mathjax/" class="sidebar-link">vuepress-plugin-mathjax</a></li><li><a href="/en/plugins/medium-zoom/" class="sidebar-link">vuepress-plugin-medium-zoom</a></li><li><a href="/en/plugins/migrate/" class="sidebar-link">vuepress-plugin-migrate</a></li><li><a href="/en/plugins/named-chunks/" class="sidebar-link">vuepress-plugin-named-chunks</a></li><li><a href="/en/plugins/nprogress/" class="sidebar-link">vuepress-plugin-nprogress</a></li><li><a href="/en/plugins/redirect/" class="sidebar-link">vuepress-plugin-redirect</a></li><li><a href="/en/plugins/serve/" class="sidebar-link">vuepress-plugin-serve</a></li><li><a href="/en/plugins/zooming/" class="sidebar-link">vuepress-plugin-zooming</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Tools</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="vuepress-plugin-git-log"><a href="#vuepress-plugin-git-log" aria-hidden="true" class="header-anchor">#</a> vuepress-plugin-git-log <a rel="noopener noreferrer" target="_blank" title="vuepress/vuepress-plugin-git-log" href="https://github.com/vuepress/vuepress-plugin-git-log" class="github-link"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M14 0C6.27 0 0 6.43 0 14.36c0 6.34 4.01 11.72 9.57 13.62.7.13.96-.31.96-.69 0-.34-.01-1.24-.02-2.44-3.89.87-4.72-1.92-4.72-1.92-.64-1.66-1.55-2.1-1.55-2.1-1.27-.89.1-.87.1-.87 1.4.1 2.14 1.48 2.14 1.48 1.25 2.19 3.28 1.56 4.07 1.19.13-.93.49-1.56.89-1.92-3.11-.36-6.38-1.59-6.38-7.09 0-1.57.55-2.85 1.44-3.85-.14-.36-.62-1.82.14-3.8 0 0 1.18-.39 3.85 1.47a12.8 12.8 0 0 1 3.5-.48c1.19.01 2.39.16 3.5.48 2.67-1.86 3.85-1.47 3.85-1.47.76 1.98.28 3.44.14 3.8.9 1 1.44 2.28 1.44 3.85 0 5.51-3.27 6.73-6.39 7.08.5.44.95 1.32.95 2.66 0 1.92-.02 3.47-.02 3.94 0 .38.25.83.96.69C23.99 26.07 28 20.7 28 14.36 28 6.43 21.73 0 14 0z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></a></h1> <p><code>vuepress-plugin-git-log</code> is a plugin that integrates git logs into your page.</p> <h2 id="usage"><a href="#usage" aria-hidden="true" class="header-anchor">#</a> Usage</h2> <h3 id="global-installation"><a href="#global-installation" aria-hidden="true" class="header-anchor">#</a> Global Installation</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">npm</span> <span class="token function">install</span> -g vuepress-plugin-git-log
<span class="token comment"># OR</span>
<span class="token function">yarn</span> global <span class="token function">add</span> vuepress-plugin-git-log
</code></pre></div><h3 id="local-installation"><a href="#local-installation" aria-hidden="true" class="header-anchor">#</a> Local Installation</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">npm</span> <span class="token function">install</span> vuepress-plugin-git-log
<span class="token comment"># OR</span>
<span class="token function">yarn</span> <span class="token function">add</span> vuepress-plugin-git-log
</code></pre></div><h3 id="add-to-config-js"><a href="#add-to-config-js" aria-hidden="true" class="header-anchor">#</a> Add to <code>config.js</code></h3> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  plugins<span class="token punctuation">:</span> <span class="token punctuation">[</span>
    <span class="token punctuation">[</span><span class="token string">'git-log'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
      additionalArgs<span class="token punctuation">:</span> <span class="token string">'--no-merge'</span><span class="token punctuation">,</span>
      onlyFirstAndLastCommit<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
    <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre></div><p>or</p> <div class="language-js extra-class"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  plugins<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    <span class="token string">'git-log'</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
      additionalProps<span class="token punctuation">:</span> <span class="token punctuation">{</span>
        subject<span class="token punctuation">:</span> <span class="token string">'%s'</span><span class="token punctuation">,</span>
        authorEmail<span class="token punctuation">:</span> <span class="token string">'%ae'</span><span class="token punctuation">,</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h2 id="api"><a href="#api" aria-hidden="true" class="header-anchor">#</a> API</h2> <p>This plugin will add a <code>git</code> property to <code>$page</code>, with the following properties:</p> <h3 id="git-author"><a href="#git-author" aria-hidden="true" class="header-anchor">#</a> git.author</h3> <p>The author of the article, i.e. the author of the first commit.</p> <h3 id="git-created"><a href="#git-created" aria-hidden="true" class="header-anchor">#</a> git.created</h3> <p>The time the article was created, i.e. the authoring time of the first commit.</p> <h3 id="git-updated"><a href="#git-updated" aria-hidden="true" class="header-anchor">#</a> git.updated</h3> <p>The time the article was updated, i.e. the committing time of the last commit.</p> <h3 id="git-commits"><a href="#git-commits" aria-hidden="true" class="header-anchor">#</a> git.commits</h3> <p>A list of all the commits in chronological order.</p> <h3 id="git-contributors"><a href="#git-contributors" aria-hidden="true" class="header-anchor">#</a> git.contributors</h3> <p>A list of contributors to all users who have modified the article.</p> <h2 id="configurations"><a href="#configurations" aria-hidden="true" class="header-anchor">#</a> Configurations</h2> <h3 id="formattime"><a href="#formattime" aria-hidden="true" class="header-anchor">#</a> formatTime</h3> <ul><li><strong>type:</strong> <code>(timestamp: number, lang: string) =&gt; string</code></li> <li><strong>default:</strong> <code>(timestamp, lang) =&gt; new Date(timestamp).toLocaleString(lang)</code></li></ul> <p>A function used to format Unix time.</p> <h3 id="additionalprops"><a href="#additionalprops" aria-hidden="true" class="header-anchor">#</a> additionalProps</h3> <ul><li><strong>type:</strong> <code>{ [prop: string]: string }</code></li> <li><strong>default:</strong> <code>{}</code></li></ul> <p>An object that represents additional properties. Every key is a property name and value is the corresponding <a href="https://git-scm.com/docs/git-log#_pretty_formats" target="_blank" rel="noopener noreferrer">placeholder<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <h3 id="additionalargs"><a href="#additionalargs" aria-hidden="true" class="header-anchor">#</a> additionalArgs</h3> <ul><li><strong>type:</strong> <code>string | string[]</code></li> <li><strong>default:</strong> <code>[]</code></li></ul> <p>A list of additional parameters to pass in.</p> <h3 id="extendgitlog"><a href="#extendgitlog" aria-hidden="true" class="header-anchor">#</a> extendGitLog</h3> <ul><li><strong>type:</strong> <code>(git: object) =&gt; void</code></li> <li><strong>default:</strong> <code>undefined</code></li></ul> <p>A function used to extend or modify the <a href="#api"><code>$page.git</code></a> object.</p> <h3 id="onlyfirstandlastcommit"><a href="#onlyfirstandlastcommit" aria-hidden="true" class="header-anchor">#</a> onlyFirstAndLastCommit</h3> <ul><li><strong>type:</strong> <code>boolean</code></li> <li><strong>default:</strong> <code>false</code></li></ul> <p>Whether to search for only the first and last commit. Set this option to <code>true</code> for large-scale projects may optimize the initial startup performance. However, you will not be able to use <code>$page.git.commits</code> and <code>$page.git.contributors</code> as a cost.</p></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/vuepress/vuepress.github.io/edit/master/docs/en/plugins/git-log.md" target="_blank" rel="noopener noreferrer">Edit this page on GitHub</a> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">3/20/2019, 5:29:39 AM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/en/plugins/dehydrate/" class="prev">
          vuepress-plugin-dehydrate
        </a></span> <span class="next"><a href="/en/plugins/mathjax/">
          vuepress-plugin-mathjax
        </a>
        →
      </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.83cb924b.js" defer></script><script src="/assets/js/2.96e68d5e.js" defer></script><script src="/assets/js/14.78046e0f.js" defer></script><script src="/assets/js/5.1cd3ace7.js" defer></script>
  </body>
</html>
